package com.hdsx.restful.glzt.roadline.ldss.rest;

import java.util.List;

import javax.annotation.Resource;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.springframework.stereotype.Service;

import com.hdsx.restful.glzt.roadline.ldss.bean.Ldss;
import com.hdsx.restful.glzt.roadline.ldss.service.LdssService;
import com.hdsx.restful.util.EasyUI;

@Path("/ldss")
@Service
public class LdssRestServer {
	@Resource(name="ldssServiceImpl")
	private LdssService ldssService;

	/**
	 * Gets the list.
	 * http://192.168.0.103:8080/restful/rest/ldss/list?lxdm=H108&page=0&rows=10
	 * @param
	 * @param
	 * @return the list
	 */
	@GET
	@Path("/list")
	@Produces(MediaType.APPLICATION_JSON)
	public EasyUI<Ldss> queryList(@QueryParam("lxdm") String lxdm,@QueryParam("page") int page,@QueryParam("rows") int rows) {
		EasyUI<Ldss> uiPage = new EasyUI<Ldss>(page, rows);
		int count =ldssService.queryCountByParameter(lxdm);
		List<Ldss> servicefws= ldssService.queryByParameter(lxdm,uiPage.getBegin(),uiPage.getEnd());
		uiPage.setTotal(count);
		uiPage.setRows(servicefws);
		return uiPage;
	}
	

	@GET
	@Path("/queryLdssString")
	@Produces(MediaType.APPLICATION_JSON)
	public String queryLdssString(@QueryParam("id") String id)
	{
		return ldssService.queryLdssString(id);
	}
}
